package 华为笔试;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        int[][] matrix = new int[m][n];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                matrix[i][j] = sc.nextInt();
            }
        }

    }

    public static int solution(int[][] matrix, int m, int n) {
        int[][] help = new int[m][n];
        help[0][0] = matrix[0][0];
        for (int i = 1; i < m; i++) {
            help[i][0] = help[i - 1][0] + matrix[i][0];
            if (matrix[i][0] == matrix[i - 1][0]) {
                help[i][0] = help[i][0] - 1;
            }
        }
        for (int i = 1; i < n; i++) {
            help[0][i] = help[0][i - 1] + matrix[0][i];
            if (matrix[0][i] == matrix[0][i - 1]) {
                help[0][i] = help[0][i] - 1;
            }
        }
        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++) {
                int row = 1;
            }
        }
        return 1;
    }


}
